package com.mind.adjust.service.impl;

import com.mind.system.domain.AjBussinessGroup;
import com.mind.adjust.mapper.AjBussinessGroupMapper;
import com.mind.adjust.service.AjBussinessGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 业务组别(AjBussinessGroup)表服务实现类
 *
 * @author makejava
 * @since 2024-08-01 18:16:11
 */
@Service("bussinessGroupService")
public class AjBussinessGroupServiceImpl implements AjBussinessGroupService {
    @Autowired
    private AjBussinessGroupMapper bussinessGroupMapper;

    /**
     * 查询业务组别信息集合
     * 
     * @param bussinessGroup 业务组别信息
     * @return 业务组别信息集合
     */
    @Override
    public List<AjBussinessGroup> selectBussinessGroupList(AjBussinessGroup bussinessGroup)
    {
        return bussinessGroupMapper.selectBussinessGroupList(bussinessGroup);
    }

    /**
     * 通过业务组别ID查询业务组别信息
     * 
     * @param bussinessGroupId 业务组别ID
     * @return 角色对象信息
     */
    @Override
    public AjBussinessGroup selectBussinessGroupById(Long bussinessGroupId)
    {
        return bussinessGroupMapper.selectBussinessGroupById(bussinessGroupId);
    }

    /**
     * 删除业务组别信息
     * 
     * @param bussinessGroupId 业务组别ID
     * @return 结果
     */
    @Override
    public int deleteBussinessGroupById(Long bussinessGroupId)
    {
        return bussinessGroupMapper.deleteBussinessGroupById(bussinessGroupId);
    }

    /**
     * 批量删除业务组别信息
     * 
     * @param bussinessGroupIds 需要删除的业务组别ID
     * @return 结果
     */
    @Override
    public int deleteBussinessGroupByIds(Long[] bussinessGroupIds)
    {
        return bussinessGroupMapper.deleteBussinessGroupByIds(bussinessGroupIds);
    }

    /**
     * 新增保存业务组别信息
     * 
     * @param bussinessGroup 业务组别信息
     * @return 结果
     */
    @Override
    public int insertBussinessGroup(AjBussinessGroup bussinessGroup)
    {
        return bussinessGroupMapper.insertBussinessGroup(bussinessGroup);
    }

    /**
     * 修改保存业务组别信息
     * 
     * @param bussinessGroup 业务组别信息
     * @return 结果
     */
    @Override
    public int updateBussinessGroup(AjBussinessGroup bussinessGroup)
    {
        return bussinessGroupMapper.updateBussinessGroup(bussinessGroup);
    }
    
    /**
     * 批量插入
     *
     * @param bussinessGroupList 附件类型信息
     * @return 结果
     */
    @Override
    public int batchInsert(List<AjBussinessGroup> bussinessGroupList) {
        int size = 0;
        for(AjBussinessGroup bussinessGroup: bussinessGroupList) {
            if (bussinessGroupMapper.selectBussinessGroupByName(bussinessGroup.getName()) == null){
                bussinessGroupMapper.insertBussinessGroup(bussinessGroup);
                size ++;
            }
        }
        return size;
    }
}
